<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>tl-ops-manage后台</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <script src="../lib/axios.js"></script>
    <script src="../lib/layui/layui.js" v="layui" e="layui"></script>
    <link rel="stylesheet" type="text/css" href="../lib/layui/css/layui.css" />
</head>
<style>
    input {
        color: darkorchid;
        font-weight: 700;
    }
</style>
<body>
    <div class="layui-fluid" style="padding: 20px;">
        <div class="layui-card">
            <div class="layui-card-body">
                <script id="tl-ops-web-shdict-view-tpl" type="text/html">
                    <pre class="layui-code"> {{d}} </pre>
                </script>
                <div id="tl-ops-web-shdict-view"></div>
            </div>
        </div>
    </div>

    <script src="../lib/tl_ops_web_comm.js"></script>
    <script>
        layui.use(['laytpl', 'layedit', 'code'], async () => {
            window.$ = layui.$;
            window.form = layui.form;
            window.laytpl = layui.laytpl;
            window.layedit = layui.layedit;
            window.code = layui.code;

            let type = tl_request_get_param("type");
            let key = tl_request_get_param("key");

            let value = ""
            if(type && key){
                let res = await axios.get("/tlops/state/shdict/key/get?type="+type+"&key="+key);
                res = res.data;
                if(res.code === 0){
                    value = res.data.value;
                    try{
                        value = JSON.parse(value);
                        value = JSON.stringify(value, null, "\t")
                    }catch(e){

                    }
                }
            }
            
            laytpl(document.getElementById("tl-ops-web-shdict-view-tpl").innerHTML).render((() => {
                return value
            })(), (html) => {
                document.getElementById("tl-ops-web-shdict-view").innerHTML = html;
            });
        });
    </script>
</body>

</html>